<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <h1>index.html</h1>
    <script>
      /*     const xhr = new XMLHttpRequest();
      xhr.open("Get", "http://127.0.0.1:3000/users?name=jack&age=20");
      xhr.responseType = "json";
      xhr.onload = () => console.log(xhr.response);
      xhr.send(); */

      /* const xhr = new XMLHttpRequest();
      xhr.open("POST", "http://127.0.0.1:3000/users");
      xhr.responseType = "json";
      xhr.setRequestHeader("content-type", "application/json");
      xhr.onload = () => console.log(xhr.response);
      xhr.send(
        JSON.stringify({
          name: "rose",
          age: 23,
          gender: 2,
        })
      ); */

      // de525a95-ff48-4fdf-91d5-1270fccda52a
      /* const xhr = new XMLHttpRequest();
      xhr.open(
        "DELETE",
        "http://127.0.0.1:3000/users/de525a95-ff48-4fdf-91d5-1270fccda52a"
      );
      xhr.responseType = "json";
      xhr.onload = () => console.log(xhr.response);
      xhr.send(); */

      // 03f24345-be75-4212-b2e2-eb5b98cae35b

      const xhr = new XMLHttpRequest();
      xhr.open(
        "PATCH",
        "http://127.0.0.1:3000/users/03f24345-be75-4212-b2e2-eb5b98cae35b"
      );
      xhr.responseType = "json";
      xhr.onload = () => console.log(xhr.response);

      xhr.setRequestHeader("content-type", "application/json");
      xhr.send(
        JSON.stringify({
          name: "lucy123",
        })
      );
    </script>
  </body>
</html>
